function throttle (fn, time) {
    let timer = null, lastTime:number = null;
    return function (...args) {
        if (timer) {
            clearInterval(timer)
            timer = null
        }
        const now = +new Date(),
        duration = lastTime+time -now,
        that = this
        if (duration > 0){
            timer = setInterval(() => {
                fn.apply(that, args)
            },duration)
        }else{
            fn.apply(that, args)
        }
    }
}
// 计算器加法  calculate(4)(5)('+')
// What(是什么) --- How（使用场景） --- Why（解决了什么痛点）
// 函数柯里化是将参数拆分执行
function curry (fn, len) {
    const argArr = []
    return function (...args) {
        argArr.push(...args)
        const that = this
        if (argArr.length >= len) {
            fn.apply(that, argArr)
    } else {
        return curry.apply(that, fn, argArr)
        fn.apply(that, argArr)
    }

    }
}
function calculate (){

}
